package com.candy.array;

import com.candy.oop.Student;

public class Test01 {
    public static void main(String[] args) {

        test03();
    }

    public static void test03() {
//        声明一个二维数组
        int[][] array_01=new int[][]{{3,5,9},{2,9,8},{5,9,6,9}};
        System.out.println(array_01[0][1]);
//        使用双层for循环来遍历二维数组
//        外层循环遍历行
        for (int i = 0; i <array_01.length ; i++) {
//            内层循环遍历列
            for (int j = 0; j <array_01[i].length ; j++) {
                System.out.print(array_01[i][j]+"\t");

            }
            System.out.println();

        }



    }

    public static void test02() {
        Student[] stus=new Student[]{new Student("tom",21,true),new Student("lily",22,false)};
        for (Student stu:stus
             ) {
            System.out.println(stu);
        }

    }

    public static void test01() {
//        声明一个int数组
        int[] ayy_01=new int[]{1,3,5};
        System.out.println(ayy_01[1]);
        System.out.println(ayy_01.length);
//        System.out.println(ayy_01[3]);
//        数组的遍历
        for (int i = 0; i < ayy_01.length; i++) {
            System.out.print(ayy_01[i]+"\t");

        }
        System.out.println();
        int[] array_02 =new int[10];
        System.out.println(array_02[1]);
//       使用foreach进行遍历
        for (int num:array_02
             ) {
            System.out.println(num);
        }

    }
}
